-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically add Longhorn device to the group id 6 (disk group) by default #79
Conversation
…efault More explanation is at longhorn/longhorn#8088 (comment) longhorn-8088 Signed-off-by: Phan Le <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. LGTM.
Should we be using the symbolic name "disk" for the group instead of hard coding the number 6? I don't know if it is guaranteed by linux or posix that disk will always be the number 6 (although it's 6 in every example I have looked at so far.) |
Thanks @markhillgit for the feedback! I thought about this before but have a few concerns
WDYT? |
I was annoyed that I didn't understand exactly WHY disk device nodes typically have group I also found it strange that the device nodes representing a Longhorn disk in OTHER locations DO have group For example, on my Ubuntu node,
I think the answer is udev rules. While a Longhorn volume is attaching:
Checking the udev rules for the block subsystem, it looks like group
We do not rely on udev to create the https://man7.org/linux/man-pages/man2/mknod.2.html So I guess it makes sense that we must change the ownership as you are doing in this PR. If we bind mounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Interesting findings! I am thinking if it's possible to udev rather than mknod then we don't need to worry about conventions like disk group. |
Converting to draft PR because we also need to change the ownership for block device created by v2 engine |
Hi @shuo-wu , I think even if we use udev, we should still stick with the convention that Longhorn device will have a fixed group id 6. This will make it easier for the user to define their workload pod: user adds group 6 and know that the pod will work on every node it is deployed to no matter which underlying OS distro it is. We don't have to follow the default value that the OS chooses for the disk group. If Longhorn watches and sets Longhorn device the same as the disk group id that OS chooses. Sometimes it will be 6 (the most common cases), sometimes it will be 493 (SUSE OS). This means that a pod with group id 6 will work ok when it is deployed to some nodes and fail to work when it is deployed on other nodes. This is an inconsistent behavior IMO. The pod would have to include all possible values like 6,493, ... to be run on every node if we choose this approach. |
V2 engine will be fix at longhorn/go-spdk-helper#86. This PR is ready for merging since test passed https://ci.longhorn.io/job/private/job/longhorn-tests-regression/6602/ |
If the disk group ID is different from the default 6, then users need to handle it on their own to add the ID to the SupplementalGroups, right? If yes, we need to document this. |
@innobead The merged PR doesn't dynamically change the Longhorn device to have same group ID as the default group ID for
We will document this point in our doc |
Assuming that |
I think yes, the users can always add group 6 to the pod.Spec.SecurityContext regardless of what ID the underlying OS chooses for the name |
Sounds good. Well done. |
@innobead This is the test result:
|
More explanation is at longhorn/longhorn#8088 (comment)
longhorn/longhorn#8088